import requests
import xlwt
url = 'https://api.codemao.cn/api/fanfic/list/all'
res = requests.get(url)
data = res.json()
#print(data)
book = []
for i in data['data']['fanficList']:
    book.append([i['title'], i['nickname']])
#print(book)
t = xlwt.Workbook()
s = t.add_sheet('图书')
for i in range(len(book)):
    for j in range(len(book[i])):
        s.write(i,j,book[i][j])
t.save('图书.xls')